<template>
    <div class="hello">
        <h1>{{user}}，{{ msg }}</h1>
    </div>
</template>

<script>
    export default {
        name: 'Welcome',
        data () {
            return {
                msg: `欢迎来到土豆集系统`,
                user: sessionStorage.getItem('user'),
            }
        },
        created() {
            window.addEventListener('setItem', ()=> {
                this.user = sessionStorage.getItem('user');
            })
        },
        mounted() {
        }
    }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
    h1, h2 {
        font-weight: normal;
    }
    ul {
        list-style-type: none;
        padding: 0;
    }
    li {
        display: inline-block;
        margin: 0 10px;
    }
    a {
        color: #42b983;
    }
</style>
